e02baf
e02baf
© Numerical Algorithms Group, 2002.
Purpose
E02BAF Least-squares curve cubic spline fit (including interpolation)
Synopsis
[lamda,c,ss,ifail] = e02baf(x,y,lamda<,w,ifail>)
Description
This routine determines a least-squares cubic spline
approximation s(x) to the set of data points (x ,y ) with
r r
weights w , for r=1,2,...,m. The values of the knots
r
(lambda) ,(lambda) ,...,(lambda)_ , interior to the data
5 6 n+3
interval, are prescribed by the user.
s(x) has the property that it minimizes (theta), the sum of
squares of the weighted residuals (epsilon) , for r=1,2,...,m,
r
where
(epsilon) =w (y -s(x )).
r r r r
The routine produces this minimizing value of (theta) and the
_
coefficients c ,c ,...,c , where q=n+3, in the B-spline
1 2 q
representation
q
--
s(x)= > c N (x).
-- i i
i=1
Here N (x) denotes the normalised B-spline of degree 3 defined
i
upon the knots (lambda) ,(lambda) ,...,(lambda) .
i i+1 i+4
In order to define the full set of B-splines required, eight
additional knots (lambda) ,(lambda) ,(lambda) ,(lambda) and
1 2 3 4
(lambda)_ ,(lambda)- ,(lambda)_ ,(lambda)_ are inserted
n+4 n+5 n+6 n+7
automatically by the routine. The first four of these are set
equal to the smallest x and the last four to the largest x .
r r
The representation of s(x) in terms of B-splines is the most
_
compact form possible in that only n+3 coefficients, in addition
_
to the n+7 knots, fully define s(x).
Subsequent evaluation of s(x) from its B-spline representation
may be carried out using E02BBF. If derivatives of s(x) are also
required, E02BCF may be used. E02BDF can be used to compute the
definite integral of s(x).
Parameters
e02baf
Required Input Arguments:
x (:) real
y (:) real
lamda (:) real
Optional Input Arguments: <Default>
w (:) real ones(length(x),1)
ifail integer -1
Output Arguments:
lamda (:) real
c (:) real
ss real
ifail integer